<include file="App/Home/View/default/Public/header.html"/>
  <link href="__PUBLIC__/css/create_drawer.css" rel="stylesheet" media="screen">
<div class="container">
  <div class="row">
    <div class="col-md-8">
      <form id="J_CreateDrawerForm" method="post" action="{:U('drawer/create_drawer')}">
          <div class="form-item">
              <label for="title" class="item-title">豆列名称</label>
              <input class="text-input" tabindex="1" id="title" name="title" type="text" value="" autofocus="" autocomplete="off">
              <p class="tips">最多可以20个中文字符</p>
              <!-- <div class="more"><i class="icon-more"></i><a href="javascript:void(0)">完善更多内容</a></div> -->
          </div>
          <div class="form-item">
              <label for="file" class="item-title">豆列封面（选填）</label>
              <div class="image-upload-wrap">
                  <div class="image-preview-box"><img width="100" height="100" src="__PUBLIC__/images/drawer-default-small.jpg" alt="" ></div>
                  <span class="btn-upload btn-normal">浏览...
                      <input  class="file-input" type="file" id="file_upload" name="drawer_cover">
                  </span>
                  <p class="tips filetype-tips">你可以上传 JPG、JPEG、GIF、PNG 或 BMP 文件。</p>
                  <p class="tips">为了保证你的封面在各种设备上都能清晰显示，请尽量选用分辨率在600*600px以上的图片。</p>
              </div>
          </div>
          <input type="hidden" name="cover" id="cover">
          <button class="btn-submit" type="submit">确认</button>
          <a class="btn-normal" href="{:U('wower')}">取消</a>
      </form>
    </div>
    <div class="col-md-4">
      
    </div>
  </div>
</div>
<script src="__PUBLIC__/Multicuploads/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript">
    <?php $timestamp = time(); ?>
    var uploadPath = '__ROOT__/Public/Uploads/';
    $(function() {
        //数据验证
        $('#J_CreateDrawerForm').submit(function() {
          var title = $('input[name="title"]').val();
          if (!$.trim(title)) { 
            alert('标题必须填写');
            return;
          };
        });

        $('#file_upload').uploadify({
            //formData用于传递一些数据到后台
            'formData'     : {
                
            },
            'swf'      : '__PUBLIC__/Multicuploads/uploadify.swf',
            'uploader' : '{:U('Drawer/upload_cover')}',
            'method'   : 'post',
            'buttonText':'选择图片',
            'progressData':'percentage',
            'removeCompleted':false,
            'onUploadSuccess' : function(file, data) {
                  var coverPath = uploadPath + data;
                  console.log(coverPath);
                  $('.image-preview-box').find('img').attr('src', coverPath);
                  $('#cover').val(data);

                },
            'onQueueComplete':function(){
                
              }
        });
    });
</script>
<include file="App/Home/View/default/Public/footer.html"/>